define(["KeyHeatPoint"],function(KeyHeatPoint){

	var utils = new Object;

	utils.showAdminInterface = false;
	utils.skipSave = false;
	utils.stopanalyse = false;
	utils.realTimeCharMap = false;
	utils.TYPE = {
		'HEATMAPOWNER' :0,
		'HEATMAPBORROWER': 1
	};
	utils.KEY = {
	    'BACKSPACE': 8,
	    'TAB': 9,
	    'ENTER': 13,
	    'SHIFT': 16,
	    'CTRL': 17,
	    'ALT': 18,
	    'PAUSE': 19,
	    'CAPSLOCK': 20,
	    'ESC': 27,
	    'PAGEUP': 33,
	    'PAGEDOWN': 34,
	    'END': 35,
	    'HOME': 36,
	    'LEFTARROW': 37,
	    'UPARROW': 38,
	    'RIGHTARROW': 39,
	    'DOWNARROW': 40,
	    'INSERT': 45,
	    'DELETE': 46,
	    'N0': 48,
	    'N1': 49,
	    'N2': 50,
	    'N3': 51,
	    'N4': 52,
	    'N5': 53,
	    'N6': 54,
	    'N7': 55,
	    'N8': 56,
	    'N9': 57,
	    'A': 65,
	    'B': 66,
	    'C': 67,
	    'D': 68,
	    'E': 69,
	    'F': 70,
	    'G': 71,
	    'H': 72,
	    'I': 73,
	    'J': 74,
	    'K': 75,
	    'L': 76,
	    'M': 77,
	    'N': 78,
	    'O': 79,
	    'P': 80,
	    'Q': 81,
	    'R': 82,
	    'S': 83,
	    'T': 84,
	    'U': 85,
	    'V': 86,
	    'W': 87,
	    'X': 88,
	    'Y': 89,
	    'Z': 90,
	    'UE': 186,
	    'AE': 222,
	    'OE': 192,
	    'NUMPAD0': 96,
	    'NUMPAD1': 97,
	    'NUMPAD2': 98,
	    'NUMPAD3': 99,
	    'NUMPAD4': 100,
	    'NUMPAD5': 101,
	    'NUMPAD6': 102,
	    'NUMPAD7': 103,
	    'NUMPAD8': 104,
	    'NUMPAD9': 105,
	    'MULTIPLY': 106,
	    'PLUS': 107,
	    'MINUS': 109,
	    'NUMPADDOT': 110,
	    'SLASH1': 111,
	    'F1': 112,
	    'F2': 113,
	    'F3': 114,
	    'F4': 115,
	    'F5': 116,
	    'F6': 117,
	    'F7': 118,
	    'F8': 119,
	    'F9': 120,
	    'F10': 121,
	    'F11': 122,
	    'F12': 123,
	    'MULT_PLUS': 187,
	    'COMA': 188,
	    'HIGHCOMA': 221,
	    'QUESTIONMARK': 219,
	    'HASH': 191,
	    'DOT': 190,
	    'UNDERLINE': 189,
	    'TILT': 220,
	    'SPACE': 32,
	    'NUMPAD': 144,
	    'PIPE': 226
	};
	
	utils.getCharCount = function(xString,xChar){
    	return xString.split(xChar).length-1;
	};
	utils.extend = function(destination, source){
		destination.prototype = Object.create(source.prototype);
		destination.prototype.constructor = destination;
		return source.prototype;
	};
	utils.calcMousePostion = function (target,destination,startMouseOffset){
		var x  =startMouseOffset[0],
			y = startMouseOffset[1],
			currentDomObj = target;

// offsetParent
// parentElement
//  offsetLeft 
		while(currentDomObj != destination){
			
			if(currentDomObj == null) break;

			x += currentDomObj.offsetLeft - currentDomObj.parentElement.offsetLeft ;
			y += currentDomObj.offsetTop  - currentDomObj.parentElement.offsetTop ;

			currentDomObj  = currentDomObj.parentElement;			
		}
		return {x:x,y:y};
	}

	return utils;
});